using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace MeteorShower
{
    class Meteor
    {
        Vector2 meteorposition;
        Random rnd = new Random();
        int x = -300;
        int y = 200;         
        Vector2 origin;
        //int s_x = 840;
        int s_y = 480;

        float size = .1f;
        double size2 = 1; 
        float angle = .1f; 
        double rotationspeed = 1;
        int speed = 5;
        int number = 1; 

        
        
       
        public Meteor()
        {
            origin = new Vector2();
            meteorposition = new Vector2();
            meteorposition.X = x;
            meteorposition.Y = y;

            
        }

        public void Move()
        {
            x = x - speed;
            meteorposition.X = x; 
        }

        public void Respawn()
        {
            x = rnd.Next(850,1300);
            meteorposition.X = x;
            y = rnd.Next(s_y/8 + 25 , s_y - 25);
            speed = rnd.Next(3, 9);
            //rotationspeed = rnd.Next(1, 1.3);
            number = rnd.Next(0, 6);
            Console.WriteLine(number);
            switch (number)
            {
                case 1:
                    size = .1f;
                    size2 = 1; 
                    break;
                case 2:
                    size = .12f;
                    size2 = 1.2; 
                    break;
                case 3:
                    size = .15f;
                    size2 = 1.5; 
                    break;
                case 4:
                    size = .17f;
                    size2 = 1.7; 
                    break;
                case 5:
                    size = .19f;
                    size2 = 1.9; 
                    break;
                case 6:
                    size = .2f;
                    size2 = 2; 
                    break;
                default:
                    size = .1f;
                    size2 = 1; 
                    break;
            }
            meteorposition.Y = y; 
        }

        public void CheckMeteor()
        {
            if (x <= -200)
            {
                Respawn();
            }
        }

        public Vector2 getmeteorposition()
        {
            return meteorposition; 
        }

        public float getmeteorx()
        {
            return meteorposition.X;
        }
        public double getmeteorx2()
        {
            return meteorposition.X - 25 * size2;
        }

        public float getmeteory()
        {
            return meteorposition.Y;
        }
        public double getmeteory2()
        {
            //double calibrated_size = meteorposition.Y - 25 * size2; 
            return meteorposition.Y ;
        }

        
        public void rotate_meteor()
        {
            angle *= (float)rotationspeed;
            
        }

        public float meteor_rotation()
        {
            return angle; 
        }

        public float getmeteorsize()
        {
            return .1f; 

        }
        public double getmeteorsize2()
        {
            return size2;

        }
    }
}
